package sort;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;


public class SortOfJDK {

	public static void main(String[] args) {
		
		int[] arr1 = {7,4,1,9,6,3,8,2,5};
		Arrays.sort(arr1);
		for (int i : arr1){
			System.out.print(i + " ");
		}
		
		System.out.println();
		
		Integer[] arr2 = {7,4,1,9,6,3,8,2,5};
		Arrays.sort(arr2, Collections.reverseOrder());
		for (int i : arr2){
			System.out.print(i + " ");
		}
		
		System.out.println();
		
		int[] arr = {7,4,1,9,6,3,8,2,5};
		List<Integer> list = new ArrayList<Integer>();
		for (int i : arr){
			list.add(i);
		}
		
		Collections.sort(list);
		for (Integer i : list){
			System.out.print(i + " ");
		}
		
		System.out.println();
		
		Collections.sort(list, Collections.reverseOrder());
		for (Integer i : list){
			System.out.print(i + " ");
		}
		
	}

}
